<?php 
set_time_limit(0);

echo '<div id="postContent">asadsa';


echo($_FILES);


function getname($exname){

   $dir = "upload/";

   $i=1;

   if(!is_dir($dir)){

      mkdir($dir,0777);

   }


   while(true){

     if(!is_file($dir.$i.".".$exname)){

        $name=$i.".".$exname;

        break;

      }

     $i++;

   }


   return $dir.$name;

}


//$exname=strtolower(substr($_FILES['pictures']['name'],(strrpos($_FILES['pictures']['name'],'.')+1)));

$uploadfile = 'upload/up.jpg';

echo '<div id="postContent">';

if (move_uploaded_file($_FILES['pictures']['tmp_name'], $uploadfile)) {

   echo "<h2><font color=#ff0000>文件上传成功！</font></h2><br><br>";

}else {

   echo "<h2><font color=#ff0000>文件上传失败！</font></h2><br><br>";

}

echo "下面是文件上传的一些信息：

    <br><br>原文件名：".$_FILES['pictures']['name'] .

    "<br><br>类型：" .$_FILES['pictures']['type'] .

    "<br><br>临时文件名：".$_FILES['pictures']['tmp_name'].

    "<br><br>文件大小：".$_FILES['pictures']['size'] .

    "<br><br>错误代码：".$_FILES['pictures']['error']; 
echo '</div>';

?>